#include <stdio.h>
#include <math.h>
#include <Windows.h>

int isPrimer( int data ) {
	if ( data == 1 ) {
		return 0;
	}
	int ret = 1;
	for ( int i = 2; i <= sqrt(data); i++ ) {
		if ( data % i == 0 ) {
			ret = 0;
			break;
		}
	}
	return ret;
}

int main()
{
	DWORD start = GetTickCount();
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	
	int n = 0;
	int max = -1;
	scanf("%d", &n);
	for ( int i = 1; i <=sqrt(n); i++ ) {
		if ( n % i != 0 ) {
			continue;		
		}
		int d1 = i;
		int d2 = n / i;
		if ( isPrimer(d1) && max < d1 ) {
			max = d1;
		}

		if ( isPrimer(d2) && max < d2 ) {
			max = d2;
		}
	}
	
	printf("%d", max);
	
	DWORD time = GetTickCount() - start;
	printf("\ntime = %.2f\n", (1000.0 * time) / 905 );
	fclose(stdin);
	fclose(stdout);
	return 0;
}
